-
Notifications
You must be signed in to change notification settings - Fork 292
Validation to disallow multiple create on related entities backed by same database table #2189
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Validation to disallow multiple create on related entities backed by same database table #2189
Conversation
…tionshipForMutations
|
/azp run |
seantleonard
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are tests dependent on #2138
Are not dependent. But will require additional entities in the config and some more changes. Keeping bug-bash in mind, trying to get the logic changes in and test can follow. |
|
Now I'm onto adding test. |
|
/azp run |
src/Service.Tests/Unittests/MultipleCreateUnitTests/MultipleCreateOrderHelperUnitTests.cs
Show resolved
Hide resolved
src/Service.Tests/Unittests/MultipleCreateUnitTests/MultipleCreateOrderHelperUnitTests.cs
Show resolved
Hide resolved
src/Service.Tests/Unittests/MultipleCreateUnitTests/MultipleCreateOrderHelperUnitTests.cs
Show resolved
Hide resolved
Aniruddh25
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Waiting on safe typecast to DatabaseTable
seantleonard
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dont need isMNRelationship as a param to getreferencingEntityName otherwise looks good. As Ani mentioned, casting feedback needs addressing
seantleonard
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need not block on my feedback, only Ani's. Go ahead and make those changes and you should be good from my end. Let me know if you think we really need to keep isMNRelationship param.
Co-authored-by: Aniruddh Munde <[email protected]>
Co-authored-by: Sean Leonard <[email protected]>
…eateOrderHelperUnitTests.cs Co-authored-by: Aniruddh Munde <[email protected]>
…eateOrderHelperUnitTests.cs Co-authored-by: Aniruddh Munde <[email protected]>
Co-authored-by: Aniruddh Munde <[email protected]>
|
/azp run |
|
/azp run |
…tionshipForMutations
|
/azp run |
…tionshipForMutations
|
/azp run |
Why make this change?
DAB doesn't support multiple-create on related entities which are backed by same database table. This PR adds a validation to catch that scenario and throw a meaningful exception to the end user. Issue to track support: #2157
What is this change?
MultipleCreateOrderHelper.GetReferencingEntityName()method to catch the scenario.MultipleCreateOrderHelper.GetReferencingEntityName(), a new parameter isMNRelationship is added with default value of false. The reasoning is explained in the section.Reason for why
MultipleCreateOrderHelper.GetReferencingEntityName()is called even for M:N relationships when we know that we are always going to return an empty string?MultipleCreateOrderHelper.GetReferencingEntityName()method.MultipleCreateOrderHelperprovides unit test coverage even for the other 2 db types i.e. PgSql,MySql.How was this tested?
Sample Request(s)
Request: